﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL.Comm
{
    /// <summary>
    /// 尝试，未应用
    /// 数据访问类公共代码实现
    /// </summary>
    public class CommDAL
    {
        private SqlCommand cmd;//定义SqlCommand对象
        public CommDAL()
        {
            cmd = new SqlCommand();//SqlCommand对象实例化
            cmd.CommandType = CommandType.StoredProcedure;//设置数据库连接对象为存储过程
        }
        /// <summary>
        /// 针对数据库修改提出公共实现方法
        /// </summary>
        public bool ForEdit(SqlCommand cmd)
        {
            try
            {
                int num = SQLHelper.ExecuteSQL(cmd);
                if (num > 0)
                    return true;
                else
                    return false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 列表实现
        /// </summary>
        /// <param name="storeName">传入列表存储过程名称</param>
        /// <returns>DataSet数据集ds</returns>
        public DataSet List(string storeName)
        {
            cmd.CommandText = storeName;
            cmd.Parameters.Clear();//清除参数列表
            DataSet ds = SQLHelper.GetDataSet(cmd);
            return ds;
        }
    }
    /// <summary>
    /// 公共泛型类抽取，待完成
    /// </summary>
    /// <typeparam name="T"></typeparam>
}
